package com.example.ui_tabs;

import android.os.Bundle;
import android.provider.Contacts.People;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.ListFragment;
import android.support.v4.widget.SimpleCursorAdapter;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;

public class PlacesListSupport extends FragmentActivity {
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		
		FragmentManager fm = getSupportFragmentManager();
		if (fm.findFragmentById(android.R.id.content) == null) {
			PlacesFragment list = new PlacesFragment();
			fm.beginTransaction().add(android.R.id.content,list).commit();
		}
	}
	
	public static class PlacesFragment extends ListFragment{
		
		ArrayAdapter<String> la;
		SimpleCursorAdapter mAdapter;
		
		@Override
		public void onActivityCreated(Bundle savedInstanceState) {
			super.onActivityCreated(savedInstanceState);
			//la = new ArrayAdapter<String>(getActivity(), android.R.id.text1);
			la = new ArrayAdapter<String>(getActivity(), R.layout.entry);
			
			/*mAdapter = new SimpleCursorAdapter(getActivity(),
                    android.R.layout.simple_list_item_1, null,
                    null,
                    new int[] { android.R.id.text1}, 0);
            */
			setListAdapter(la);
			//setListAdapter(mAdapter);
            la.add("pedrengo");
            la.add("seriate");
            la.notifyDataSetChanged();

		}
	}
}
